<?php /* Smarty version 2.6.26, created on 2011-01-25 16:46:15
         compiled from admin/submodules/task.module.html */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'date_format', 'admin/submodules/task.module.html', 52, false),array('modifier', 'sslash', 'admin/submodules/task.module.html', 55, false),array('modifier', 'abs', 'admin/submodules/task.module.html', 59, false),array('function', 'math', 'admin/submodules/task.module.html', 62, false),)), $this); ?>

<script type="text/javascript">
<!--<?php echo '
$(document).ready
(
    function()
    {
	$(\'input:checkbox#tasks-only-my\').click
	(
	    function()
	    {
		$.getJSON
		(
		    \'json/taskFilter.php\',
		    { \'only_my\': ($(this).attr(\'checked\')?1:0) },
		    function(json)
		    {
			if ( json[\'code\']==200 ) { window.location.reload(); }
		    }
		);
	    }
	);
    }
);
'; ?>
-->
</script>

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "admin/submodules/task.dialog.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

<!-- НАЧАЛО блока задач -->
<table class="ui-widget ui-state-default" width="100%" cellspacing="0">
    <thead class="ui-widget-header">
	<tr>
	    <th colspan="7">Задачи</th>
	</tr>
	<tr>
	    <th>#</th>
	    <th>Создана</th>
	    <th>Постановщик</th>
	    <?php if ($_SESSION['manager']['is_admin'] == 1 && $_SESSION['filter']['tasks']['only_my'] != 1): ?><th>Ответственный</th><?php endif; ?>
	    <th>Клиент</th>
	    <th>Осталось</th>
	    <th>Задача</th>
	</tr>
    </thead>
    <tbody>
    <?php $_from = $this->_tpl_vars['tasks']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['tasks'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['tasks']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['task']):
        $this->_foreach['tasks']['iteration']++;
?>
	<tr class="task-row <?php if ($this->_tpl_vars['task']['before'] < -60): ?>ui-state-error<?php elseif ($this->_tpl_vars['task']['before'] < 10): ?>ui-state-highlight<?php else: ?>ui-state-default<?php endif; ?>">
	    <td align="right"><span style="display: none;"><?php echo $this->_tpl_vars['task']['id']; ?>
</span><?php echo $this->_foreach['tasks']['iteration']; ?>
</td>
	    <td align="center"><?php echo ((is_array($_tmp=$this->_tpl_vars['task']['date_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, '%d.%m.%Y, %H:%M') : smarty_modifier_date_format($_tmp, '%d.%m.%Y, %H:%M')); ?>
</td>
	    <td align="center"><?php echo $this->_tpl_vars['task']['c_manager']; ?>
</td>
	    <?php if ($_SESSION['manager']['is_admin'] == 1): ?><td><?php echo $this->_tpl_vars['task']['r_manager']; ?>
</td><?php endif; ?>
	    <td align="center"><a href="customer-view.php?id=<?php echo $this->_tpl_vars['task']['customer_id']; ?>
"><?php echo ((is_array($_tmp=$this->_tpl_vars['task']['customer_name'])) ? $this->_run_mod_handler('sslash', true, $_tmp) : stripslashes($_tmp)); ?>
</a></td>
	    <td align="center">
	    <?php if ($this->_tpl_vars['task']['before'] == ''): ?>
	    &mdash;
	    <?php elseif (((is_array($_tmp=$this->_tpl_vars['task']['before'])) ? $this->_run_mod_handler('abs', true, $_tmp) : abs($_tmp)) < 60): ?>
		<?php echo $this->_tpl_vars['task']['before']; ?>
 мин.
	    <?php elseif (((is_array($_tmp=$this->_tpl_vars['task']['before'])) ? $this->_run_mod_handler('abs', true, $_tmp) : abs($_tmp)) < 1440): ?>
		<?php echo smarty_function_math(array('equation' => "x/60",'x' => $this->_tpl_vars['task']['before'],'assign' => 'hours','format' => "%d"), $this);?>

		<?php echo smarty_function_math(array('equation' => "x%60",'x' => $this->_tpl_vars['task']['before'],'assign' => 'mins','format' => "%d"), $this);?>

		<?php echo $this->_tpl_vars['hours']; ?>
 ч.<?php if ($this->_tpl_vars['mins'] != 0): ?>, <?php echo ((is_array($_tmp=$this->_tpl_vars['mins'])) ? $this->_run_mod_handler('abs', true, $_tmp) : abs($_tmp)); ?>
 мин.<?php endif; ?>
	    <?php else: ?>
		<?php echo smarty_function_math(array('equation' => "x/1440",'x' => $this->_tpl_vars['task']['before'],'assign' => 'days','format' => "%d"), $this);?>

		<?php echo smarty_function_math(array('equation' => "x%1440/60",'x' => $this->_tpl_vars['task']['before'],'assign' => 'hours','days' => $this->_tpl_vars['days'],'format' => "%d"), $this);?>

		<?php echo smarty_function_math(array('equation' => "x%1440%60",'x' => $this->_tpl_vars['task']['before'],'assign' => 'mins','format' => "%d"), $this);?>

		<?php echo $this->_tpl_vars['days']; ?>
 д.<?php if ($this->_tpl_vars['hours'] != 0): ?>, <?php echo ((is_array($_tmp=$this->_tpl_vars['hours'])) ? $this->_run_mod_handler('abs', true, $_tmp) : abs($_tmp)); ?>
 ч.<?php endif; ?><?php if ($this->_tpl_vars['mins'] != 0): ?>, <?php echo ((is_array($_tmp=$this->_tpl_vars['mins'])) ? $this->_run_mod_handler('abs', true, $_tmp) : abs($_tmp)); ?>
 мин.<?php endif; ?>
	    <?php endif; ?>
	    </td>
	    <td><a href="task.php?id=<?php echo $this->_tpl_vars['task']['id']; ?>
"><?php echo $this->_tpl_vars['task']['note']; ?>
</a></td>
	</tr>
    <?php endforeach; else: ?>
	<tr><td colspan="7" align="center" class="ui-state-default"><i>нет задач</i></td></tr>
    <?php endif; unset($_from); ?>
    </tbody>
    <?php if ($_SESSION['manager']['is_admin'] == 1): ?>
    <tfoot>
	<tr>
	    <td colspan="7" align="right">
		<input type="checkbox" id="tasks-only-my" <?php if ($_SESSION['filter']['tasks']['only_my'] == 1): ?>checked<?php endif; ?>/>
		<label for="tasks-only-my">только мои задачи</label>
	    </td>
	</tr>
    </tfoot>
    <?php endif; ?>
</table>
<!-- КОНЕЦ блока задач -->